#include "Interpretator.h"
#include <QCoreApplication>

#include <iostream>

/*
 * Usage: folderPath -operation [-option]
 * Operations: -f translate fkol to c++
 *             -c translate c++ to fkol
 * Options:    -o override files without submit
 */

#include "ErrorCodes.h"

int execMain(int argc,char *argv[]){
    if(argc<3)return ErrorCode::notEnoughArguments;
    bool option=false;
    if(argc>4){
        return ErrorCode::tooManyArguments;
    }
    if(argc==4){
        if(QString(argv[3])==QString("-o")){
            option=true;
        }else{
            return ErrorCode::invalid3Argument;
        }
    }
    QString operation(argv[2]);
    if(operation==QString("-f")){
        Interpretator fkoli;
        return fkoli.translateFKOL(argv[1],option);
    }else if(operation==QString("-c")){
        //Interpretator fkoli;
        return ErrorCode::invalid2Argument; //fkoli.translateCPP(argv[1]);
    }else{
        return ErrorCode::invalid2Argument;
    }
}

int main(int argc, char *argv[]){
    QCoreApplication a(argc, argv);
    int ret=execMain(argc,argv);
    std::cout<<"Exit code: "<<ret<<std::endl;
    return ret;
}
